package cn.hhy.hrm.controller;

import cn.hhy.hrm.service.IVerifycodeService;
import cn.hhy.hrm.util.AjaxResult;
import cn.hhy.hrm.vo.SendSmsCodeVO;
import com.netflix.ribbon.proxy.annotation.Http;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/verifycode")
public class VerifycodeController {

    @Autowired
    public IVerifycodeService verifycodeService;

    @GetMapping("/imageCode/{key}")
    public AjaxResult imageCode(@PathVariable String key){

        String baseImageStr = verifycodeService.imageCode(key);
        return AjaxResult.me().setResultObj(baseImageStr);

    }

    @PostMapping("/sendSmsCode")
    public AjaxResult sendSmsCode(@RequestBody SendSmsCodeVO sendSmsCodeVO){

        verifycodeService.sendSmsCode(sendSmsCodeVO);
        return AjaxResult.me();

    }

}
